<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script type="text/javascript" src="static/js/jquery.min.js"></script>
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap-treeview.min.css"
          th:href="@{static/js/bootstrap/css/bootstrap-treeview.min.css}"
    >
    <script src="static/js/bootstrap/js/bootstrap-treeview.min.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap.addtabs.css">
    <script src="static/js/bootstrap/js/bootstrap.addtabs.min.js"></script>
    <link rel="stylesheet" href="static//js/bootstrap/css/bootstrap-table.min.css">
    <script src="static/js/bootstrap/js/bootstrap-table.min.js"></script>
    <script src="static/js/bootstrap/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="static/js/bootstrap/js/bootbox.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="static/js/bootstrap-fileinput/js/fileinput.js"></script>
    <script src="static/js/bootstrap-fileinput/js/locales/zh.js"></script>
    <link rel="stylesheet" href="static/js/bootstrap-fileinput/css/fileinput.css">

</head>
<body>
<input id="span1" th:type="hidden" th:value="${id.queryPriceId}">
<br>

<input type="button" onclick="priceParity()" class="btn" value="我要比价" STYLE="width: 100px;margin-left: 1000px">
<br>
<table id="myTable"></table>

<button onclick="addNewZeng()" class="btn btn-primary">确认中标信息</button>
</body>
<script>

    function priceParity(){
        var id = $("#span1").val()
        location.href="priceParity?id="+id
    }

    var id = $("#span1").val()
    /* 查询 */
    $("table").bootstrapTable({
        url:"showPriceChr1?id="+id,
        columns:[

            {field:'checkbox',checkbox:true},
            {field:'offerName',title:'供应商名称'},
            {field:'totalPrices',title:'项目总价'},
            {field:'offerDate',title:'报价时间'},
            {field:'offerFormValidTime',title:'报价有效时间'},
            {field:'deliveryCycle',title:'预计供货日期'},
            {field:'operation',title:'操作',formatter:function(value,row){
                    var str = "";
                    str+='<button onclick="selectQuotedChr(\''+row.offerName+'\')" class="btn btn-primary">查看报价明细</button>'
                    return str;
                }},
        ],
        pagination:true,//是否启用分页
        pageSize:3,//每页的记录行数（*）
        pageList:[3,6,9],//可供选择的每页的行数（*）
        showRefresh: false,//是否显示刷新按钮
        cardView: false,//是否显示详细视图
        sidePagination: "client",//分页方式：client客户端分页，server服务端分页（*）
        cache: false,//是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
    })

    function selectQuotedChr(name) {
        var id = $("#span1").val()
      /*  $.ajax({
            url:'selectQuotedChr',
            type:'get',
            data:{productId:id,name:name},
            success:function(){
                location.href='selectQuotedChr.html'
        }
        })
*/
        location.href = "selectQuotedChr?productId="+id+"&name="+name;
    }

    function addNewZeng(){
        var arr = $("table").bootstrapTable("getSelections");
        var nbCh = "";
        if (arr.length > 1){
            alert("只能选择一位公司进行投标")
        }else if (arr.length < 1){
            alert("必须选择一位公司进行投标")
        }else{
            for (var i = 0; i < arr.length; i++) {
                nbCh = arr[i].offerName
            }
            location.href = "addNewZeng?nbCh=" + nbCh + "&id=" + id;
        }
    }
</script>
</html>